mini.parse();

var grid = mini.get("datagrid1");
// grid.load();

var menu = new ColumnsMenu(grid);

$(function () {
    findAll();
})

function findAll() {

    var url = ajaxUrl + "/DbInfo/findAll.do";
    $.ajax({
        type : 'get',
        url  : url,
        success : function (data) {
            var dataJSON = JSON.parse(data);
            if (dataJSON.state == "success"){
                // for(var i = 0; i < dataJSON.data.length; i ++){
                    grid.setData(dataJSON.data);
                    console.log(grid)
                // }

            }else{
                mini.alert(dataJSON.message);
            }
        },
        error : function (error) {
            mini.alert("系统错误");
        }
    })
}


function GetData() {
    var row = grid.getSelected();
    return row;
}
function search() {
    var key = mini.get("cDBName").getValue();
    grid.load({ key: key });
}
function onKeyEnter(e) {
    search();
}
function onRowDblClick(e) {
    add();
}
//////////////////////////////////
function CloseWindow(action) {
    if (window.CloseOwnerWindow) return window.CloseOwnerWindow(action);
    else window.close();
}

function add() {
    CloseWindow("ok");
}
function onCancel() {
    CloseWindow("cancel");
}



